import request from '@/utils/request'

export const authAPI = {
  register(data) {
    return request({
      url: '/api/auth/register',
      method: 'post',
      data,
    })
  },

  login(data) {
    return request({
      url: '/api/auth/login',
      method: 'post',
      data,
    })
  },

  getUserInfo() {
    return request({
      url: '/api/auth/userinfo',
      method: 'get',
    })
  },

  logout() {
    return request({
      url: '/api/auth/logout',
      method: 'post',
    })
  },

  updateProfile(data) {
    return request({
      url: '/api/auth/profile',
      method: 'put',
      data,
    })
  },

  changePassword(data) {
    return request({
      url: '/api/auth/password',
      method: 'put',
      data,
    })
  },

  getUserStats() {
    return request({
      url: '/api/auth/stats',
      method: 'get',
    })
  },
}